<?php
class Admin_StatisticController extends Zend_Controller_Action{

	public function init(){
		parent::init();

	}

	public function indexAction(){
		$dateFrom = new Admin_Form_DateSelect('Statistics');
		$dateFrom->submit->setLabel('Statistics');
		$this->view->date = $dateFrom;
		$dateFrom->setMethod('get');
		$this->view->hasStatistics = false;
		$this->view->message = '';
		$date = $this->getRequest()->getParam('date');
		
		if (isset($date)){
			
				$oReturn = new Admin_Model_ScheduleMapper();
				$return = $oReturn->getStatistics($date);
				if (isset($return)){
					$dateFrom->populateData($date);
					$this->view->hasStatistics = true;
					$this->view->data = $return;
				}else{
					$this->view->hasStatistics = false;
					$this->view->message = 'No data';
				}
		}	
		else {
				$this->view->hasStatistics = false;
				$this->view->message = '';
		}

	}

	public function statisticsAction(){
		$oReturn = new Admin_Model_ScheduleMapper();
		$return = $oReturn->getStatistics($date);
		$this->view->date = $return;
		$date->setMethod('get');
		$this->view->hasStatistics = false;
		if (isset($date)) {
			echo 'Statictis' ;/*$date->$request()->getParams('date');*/
		}
	}
}